# 花色

from utils.sult import suit


class Suit:
    def __init__(self, name):
        self.name = name
        self.color = suit[name]['color']
        self.logo = suit[name]['logo']


class Card:
    ORDER = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']

    def __init__(self, No, sult_name):
        self.No = No

        # 封装花色的属性
        self.sult = Suit(sult_name)

    "单张牌比大小"

    #
    def __lt__(self, other):
        return Card.ORDER.index(self.No) < Card.ORDER.index(other.No)

    def __gt__(self, other):
        return Card.ORDER.index(self.No) > Card.ORDER.index(other.No)

    def __eq__(self, other):
        return Card.ORDER.index(self.No) == Card.ORDER.index(other.No)
    #


class PoolCard(Card):
    """
    池牌
    """
    def __init__(self, *args, **kwargs):
        self.belong = 'pool'
        super(PoolCard, self).__init__(*args, **kwargs)


class HandCard(Card):
    """
    手牌
    """
    def __init__(self, *args, **kwargs):
        self.belong = 'hand'
        super(HandCard, self).__init__(*args, **kwargs)


# 测试代码
if __name__ == '__main__':
    a = HandCard('A', 'Club')
    b = PoolCard('5', 'Club')
    c = Card('5', 'Diamond')
    print(a > b)
    print(min(a, b).No)
    print(a.belong)
